package com.cyl.wms.controller;

import com.cyl.wms.domain.PurchaseOrderDetails;
import com.cyl.wms.pojo.query.PurchaseOrderDetailsQuery;
import com.cyl.wms.service.PurchaseOrderDetailsService;
import com.ruoyi.common.core.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(description ="物料明细接口列表")
@RestController
@RequestMapping("/wms/purchaseOrderDetails")
public class PurchaseOrderDetailsController extends BaseController {
    @Autowired
    private PurchaseOrderDetailsService service;

    @ApiOperation("新增物料明细")
    @PostMapping
    public ResponseEntity<Integer> add(@RequestBody PurchaseOrderDetails PurchaseOrderDetails) {
        return ResponseEntity.ok(service.insert(PurchaseOrderDetails));
    }

    @ApiOperation("通过单号查询物料列表")
    @PostMapping("queryNumber")
    public ResponseEntity<List<PurchaseOrderDetails>> queryNumber(@RequestBody PurchaseOrderDetailsQuery purchaseOrderDetailsQuery) {
        return ResponseEntity.ok(service.selectList(purchaseOrderDetailsQuery));
    }
}
